<template>
  <div :id="vjson.id"
       :key="vjson.id"
       :class="[calcClass, 'yv-tree']"
       :style="calcStyle"
       @selectme.native="_selectMe"
       @click.stop="_selectMe"
  >
    <el-empty description="树组件"/>
  </div>
</template>

<script>
import _ from "lodash"
import {renderIcon} from '../webutils'
import VJsonContext from "../../../runtime/VJsonContext"
import Designer from "../../../studio/design/Designer"
import WebDesignMixin from "../WebDesignMixin"

export default {
  mixins: [WebDesignMixin],
  props: {
    vjson: Object,
    vcxt: VJsonContext,
    designer: Designer,
    parentComponent: Object,
    parentList: Array,
    indexOfParentList: Number,
  },
  computed: {
    icon() {
      return renderIcon(this.vjson.iconCls)
    },
  },
  created() {
  },
  mounted() {
  },
  beforeUnmount() {
  },
  methods: {},
  buildVExportData(vjson, dataRoot, useFor) {
    if (vjson.reference) {
      if (useFor === 'reviewOnly') {
        _.set(dataRoot, vjson.reference + '.selection', vjson.id)
        _.set(dataRoot, vjson.reference + '.checkedKeys', vjson.id)
        _.set(dataRoot, vjson.reference + '.checkedNodes', vjson.id)

      } else {
        _.set(dataRoot, vjson.reference + '.selection', null)
        _.set(dataRoot, vjson.reference + '.checkedKeys', [])
        _.set(dataRoot, vjson.reference + '.checkedNodes', [])
      }
    }
  },
}
</script>
<style lang="less">
.yv-design-mode .yv-tree {
  width: 100%;
  height: 100%;
  min-height: 50px;
}
</style>